<?php include (TEMPLATEPATH . '/wpress_defaults.php'); ?>
<?php
/*
	Template Name: News Page & Blog
*/
?>

<?php
  if($post->post_parent) {
  $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
  }

  else {
  $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
  }
?>

<?php get_header(); ?>


<div class="menu_shadow_top"></div> <!-- menu top shadow -->
<div class="table_top"></div><!-- table top corners -->

<!-- begin portfolio container -->
<div id="portfolio">

	<!-- begin portfolio title -->
	<div class="title_container">
		<div class="title">
			<?php include (TEMPLATEPATH . '/wpress_shortcut.php'); ?>
		</div>

		<div class="back_btn">
			<a href="javascript:history.go(-1);"><?php echo get_option('back_name', $wp_back_name); ?></a>
		</div>
	</div>
	<!-- end portfolio title -->
	
	<!-- begin portfolio container -->		
	<div class="portfolio_container">



		<!-- begin news items container -->		
		<div class="items" <?php if(!$children){ ?>style="border:0px;"<?php } ?>>	
				

				
			<?php if(have_posts()) : ?>
			<?php 
				$category_id =  get_post_meta($post->ID, "page_id", true);
				$limit = get_option('news_limit', 10);
				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
				query_posts("cat=$category_id&showposts=$limit&paged=$paged"); 
			?>
			<?php while(have_posts()) : the_post(); ?>


			<!-- begin portfolio holder -->
			<div class="holder" <?php if($children){ ?>style="border-right:1px solid #f2f2f2;"<?php } ?>>
				
				<!-- box # 1-->
				<div class="news_box" <?php if($children){ ?>style="width:730px; margin-right:10px;"<?php } else { ?>style="width:924px;"<?php } ?>>
					
					<?php if (get_post_meta($post->ID, "big_one", true)){ ?>
					<!-- box image -->
					<div class="portfolio_image">
						<a href="<?php echo get_post_meta($post->ID, "big_one", true); ?>" rel="prettyPhoto[minigallery1]"><img src="<?php echo get_post_meta($post->ID, "thumb_one", true); ?>" alt="Portfolio #1" width="215" height="90"/></a>	
					</div>
					<!-- box content -->
					<?php } ?>
					<div class="news_content">
						<h4><?php the_title(); ?> - <?php the_time('F jS, Y'); ?></h4> 
						<?php echo get_post_meta($post->ID, "short_desc", true); ?><br /> 
						<a href="<?php the_permalink() ?>"><strong><?php echo get_option('news_name', $wp_news_name); ?></strong><img src="<?php bloginfo('template_url'); ?>/images/arrow.gif" alt="Arrow"/></a>
					</div>
				</div>
			
			</div>
			<!-- end portfolio holder -->

		<?php endwhile; 
		
		

		
		endif; ?>

				
		</div>
		<!-- end news items container -->
		
		<?php 
			if($children){
		?>
		<!-- begin navigation -->
		<div class="navigation">
		
			<h4><?php echo get_option('sub_navigation', $wp_sub); ?></h4>
			<ul>
				<?php echo $children; ?>
			</ul>
			
		</div>
		<!-- end navigation -->
		<?php } ?>
	</div>
	<!-- end portfolio container -->	
	
	<div class="portfolio_pages">
		<div class="pages_numbers">
			<?php next_posts_link(get_option('older_entries', $wp_older)) ?> <?php previous_posts_link(get_option('newer_entries', $wp_newer)) ?>
		</div>
	</div>

</div>
<!-- end portfolio container -->
<div class="table_bottom"></div><!-- table bottom corners -->
<div class="side_shadow_bottom"></div><!-- slide show bottom shadow -->


<?php get_footer(); ?>
